home *** CD-ROM | disk | FTP | other *** search
- Path: lyra.csx.cam.ac.uk!mae20
- From: mae20@cus.cam.ac.uk (M.A. Elliott)
- Newsgroups: comp.lang.c
- Subject: Capturing useful return values from the parallel port
- Date: 19 Mar 1996 09:30:16 GMT
- Organization: University of Cambridge, England
- Message-ID: <4ilur8$hgi@lyra.csx.cam.ac.uk>
- NNTP-Posting-Host: ursa.cus.cam.ac.uk
-
- I am building a small routine which is designed to return values 1-4 from a four
- button resposne box plugged into the parallel port. The buttons normally return
- bits 0 through 3 but I am having problems converting these, elegantly, into the
- required values.
-
- I have been using a routine which returns the product of an XOR bit
- transformation. This is fine for two buttons, but obviously not for four.
-
- The routine that does this looks like this:
-
- @define PORTID 0x379
-
- unsigned pressedKey(void)
- {
-
- return ((inportb(PORTID) >> 6) ^1);
-
- }
-
-
- If you are able to help me with this I would appreciate contact through either my
- Cambridge email or London email addresses. The London one is
-
-
- m.elliott@psyc.bbk.ac.uk
-
-
- Many Thanks
-
-
- Mark
-